
*	************************************************************************
* 	File-Name: 		geography_prep.do
*	Date:  			19 July 2019
*	Corr Author:	Patrick Bayer
*	Paper:			Shades of Darkness or Light? A Systematic Review of 
*					Geographic Bias in Impact Evaluations of Electricity Access
*					Energy Research & Social Science
*	Data Used:  	Geography_data.xls 
*	************************************************************************


*	************************************************************************
*   Techincal disclaimer:
*   All files/ data were created/ analysed in Stata/SE 14.2 on Windows 10, 64 bit
*	Machine: Intel(R) Core(TM) i7-4650U CPU @ 1.70Ghz 2.30Ghz with 8GB RAM
*	************************************************************************

clear all
set more off, permanently

*	************************************************************************
*	A. Load data and setup
*	************************************************************************

import excel "./geography_data.xlsx", sheet("Sheet1") firstrow
drop if ID==.

*	************************************************************************
*	B. Clean up, create and label variables
*	************************************************************************

* Method variable

replace Method="Observational" if Method=="Observational "

gen temp = .
replace temp=1 if Method=="Observational"
replace temp=2 if Method=="Experiment"
drop Method
rename temp Method
label define mlabel 1 "Observational" 2 "Experiment"
label value Method mlabel
label variable Method "Method type"

* Technology variable

gen temp = . 
replace temp=1 if Technology=="grid"
replace temp=2 if Technology=="off-grid"
drop Technology
rename temp Technology
label define tlabel 1 "grid" 2 "off-grid"
label value Technology tlabel
label variable Technology "Technology type"

order Technology, after(Country)

* Variable variable

replace Variable=Variable+1
replace Variable=0 if Variable==.
label define vlabel 0 "Not assessed" 1 "Similar variable" 2 "Exact variable"
label value Variable vlabel
label variable Variable "Outcome variable (indicator)"

* Outcome variable

gen temp=.
replace temp=1 if Outcome=="Business creation"
replace temp=2 if Outcome=="Education"
replace temp=3 if Outcome=="Energy expenditures"
replace temp=4 if Outcome=="Household income/expenditure"
replace temp=5 if Outcome=="Household savings"

drop Outcome
rename temp Outcome
label define olabel 1 "Business creation" 2 "Education" 3 "Energy expenditure" 4 "HH income" 5 "HH savings"
label value Outcome olabel
label variable Outcome "Outcome variable"
order Outcome, after(Variable)

* Results variable

replace Results="negative" if Results=="negative "
gen temp=.
replace temp=-1 if Results=="negative"
replace temp=0 if Results=="none"
replace temp=1 if Results=="positive"

drop Results
rename temp Results

label define rlabel -1 "negative" 0 "none" 1 "positive"
label value Results rlabel
label variable Results "Results"

order Results, after(Outcome)

* Impact variable

gen temp=.
replace temp=-1 if Impact=="negative"
replace temp=0 if Impact=="neutral"
replace temp=1 if Impact=="positive"

drop Impact
rename temp Impact
label define ilabel -1 "negative" 0 "neutral" 1 "positive"
label value Impact ilabel
label variable Impact "Impact"

order Impact, after(Results)


* Region dummy
gen region=0
replace region=1 if Country=="India" | Country=="Bangladesh" | Country=="Nepal"
replace region=2 if Country=="Rwanda" | Country=="South Africa" | Country=="Nigeria" | Country=="Kenya" | Country=="Tanzania" | Country=="Uganda"
replace region=3 if Country=="Colombia" | Country=="El Salvador" | Country=="Peru"
replace region=4 if Country=="Indonesia" | Country=="Thailand" | Country=="Vietnam"

label define regionlabel 1 "South Asia" 2 "SSA" 3 "LAC" 4 "South East Asia"
label value region regionlabel


*	************************************************************************
*								END OF DO FILE 
*	************************************************************************



